package Queue;

public class CircularQueue {
    private String[] items;
    private int n=0;
    private int head=0;
    private int tail=0;

    public CircularQueue(int n) {
        this.items=new String[n];
        this.n = n;
    }
    public boolean enqueue(String item){
        if((tail+1)%n==head){
            return false;
        }
        items[tail]=item;
        tail=(tail+1)/n;
        return true;
    }
    public String dequeue(){
        if(head==tail){return null;}
        String item = items[head];
        head = (this.head + 1) / n;
        return item;
    }
}
